﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
using RTGS.Library.Report;
using RTGS.Library.DataAccess.Rtgs;
using RTGS.Library.DataAccess.UserManagement;
using RTGS.Library.Entities.UserManagement;
using System.Configuration;
using RTGS.Web;

public partial class report_reportSptDetailRecordOPreview : BasePage
{

    ReportSptDetailRecordO reportDal = new ReportSptDetailRecordO(ConfigurationManager.ConnectionStrings["Rtgs"].ConnectionString);
    private stpRecordDetailORepo stpRecordDetailORepo = new stpRecordDetailORepo(ConfigurationManager.ConnectionStrings["Rtgs"].ConnectionString);

    private sysTLogRepo logDal = new sysTLogRepo(ConfigurationManager.ConnectionStrings["Rtgs"].ConnectionString);
    private sysTLog log = new sysTLog();
    protected void Page_Load(object sender, EventArgs e)
    {
       

        if (!IsPostBack)
        {
            if (Context.Request.Params["relatedtrn"] != null)
            {
                string parameters = string.Empty;
                string relatedtrn = Context.Request.Params["relatedtrn"].ToString();
                if (relatedtrn.Trim().Length > 1)
                {
                    //parameters = " WHERE [RECORD_DETAIL_ORECORD_Status] ='" + status + "'";

                    DataTable dt = reportDal.GetReportSptDetailRecordOPreview(relatedtrn);

                    rsViewer.Reset();

                    rsViewer.LocalReport.ReportPath = Server.MapPath("~/reportviewer/rptSptDetailRecordOPrev.rdlc");


                    ReportDataSource rds = new ReportDataSource();
                    rds.Name = "DataSet1";
                    rds.Value = dt;

                    ReportParameter[] param = new ReportParameter[1];
                    param[0] = new ReportParameter("user", base.UserLoggedIn);
                    //param[1] = new ReportParameter("semester", semester);
                    //param[2] = new ReportParameter("eselon", eselon);
                    //param[3] = new ReportParameter("wilayah", wilayah);
                    //param[4] = new ReportParameter("uakpb", satker);

                    rsViewer.LocalReport.SetParameters(param);

                    rsViewer.LocalReport.DataSources.Clear();
                    rsViewer.LocalReport.DataSources.Add(rds);
                    rsViewer.LocalReport.Refresh();

                    log = new sysTLog();
                    log.logEvent = "View Report SPT_DETAIL_RECORD_O Success";
                    log.logMessage = string.Empty;

                }
            }
        }
    }
}